home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Maths & Calculations / 4digit-chmod.izs next >
Text File  |  2005-07-29  |  12KB  |  314 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>4-digit Chmod Calculator
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>A beefed up version of the original chmod calculator that includes an extra "SuperUser" column. There's no stopping you from correctly setting permission on your files now!
  7.  
  8. <!/DESCRIPTION> 
  9.  
  10. <!CATEGORY>math related<!/CATEGORY>
  11.  
  12. <!SCRIPT>
  13. <!-- START OF SCRIPT -->
  14. <script language="JavaScript">
  15. <!--
  16. // 4-digit Chmod calculator
  17. // Based on code by Peter Crouch 2000. All rights reserved.
  18. // Modified 2001 to 4-digit by William E. Landfair-Owens
  19. // http://welo.ikemail.com
  20.  
  21. function calculator(user, number){
  22. // Superuser
  23. if (user == "superuser" && number == "4"){var box = eval("document.chmod.superuser4")}
  24. if (user == "superuser" && number == "2"){var box = eval("document.chmod.superuser2")}
  25. if (user == "superuser" && number == "1"){var box = eval("document.chmod.superuser1")}
  26. // Owner
  27. if (user == "owner" && number == "4"){var box = eval("document.chmod.owner4")}
  28. if (user == "owner" && number == "2"){var box = eval("document.chmod.owner2")}
  29. if (user == "owner" && number == "1"){var box = eval("document.chmod.owner1")}
  30. // Group
  31. if (user == "group" && number == "4"){var box = eval("document.chmod.group4")}
  32. if (user == "group" && number == "2"){var box = eval("document.chmod.group2")}
  33. if (user == "group" && number == "1"){var box = eval("document.chmod.group1")}
  34. // Other
  35. if (user == "other" && number == "4"){var box = eval("document.chmod.other4")}
  36. if (user == "other" && number == "2"){var box = eval("document.chmod.other2")}
  37. if (user == "other" && number == "1"){var box = eval("document.chmod.other1")}
  38. if (box.checked == true){
  39. if (user == "superuser"){
  40. document.chmod.h_superuser.value += ("+number")
  41. var a= (document.chmod.h_superuser.value)
  42. var b= eval(a)
  43. document.chmod.h_superuser.value=b
  44. document.chmod.t_superuser.value=b
  45. }if (user == "owner"){
  46. document.chmod.h_owner.value += ("+number")
  47. var a= (document.chmod.h_owner.value)
  48. var b= eval(a)
  49. document.chmod.h_owner.value=b
  50. document.chmod.t_owner.value=b
  51. }if (user == "group"){
  52. document.chmod.h_group.value += ("+number")
  53. var a= (document.chmod.h_group.value)
  54. var b= eval(a)
  55. document.chmod.h_group.value=b
  56. document.chmod.t_group.value=b
  57. }if (user == "other"){
  58. document.chmod.h_other.value += ("+number")
  59. var a= (document.chmod.h_other.value)
  60. var b= eval(a)
  61. document.chmod.h_other.value=b
  62. document.chmod.t_other.value=b
  63. }
  64. }
  65. if (box.checked == false){
  66. if (user == "superuser"){
  67. if (document.chmod.h_superuser.value == ""){
  68. document.chmod.t_superuser.value=""
  69. }else {
  70. var a=(document.chmod.h_superuser.value);
  71. b=a-(number);
  72. c=eval(b);
  73. document.chmod.h_superuser.value=c
  74. document.chmod.t_superuser.value=c
  75. }}if (user == "owner"){
  76. if (document.chmod.h_owner.value == ""){
  77. document.chmod.t_owner.value=""
  78. }else {
  79. var a=(document.chmod.h_owner.value);
  80. b=a-(number);
  81. c=eval(b);
  82. document.chmod.h_owner.value=c
  83. document.chmod.t_owner.value=c
  84. }}if (user == "group"){
  85. if (document.chmod.h_group.value == ""){
  86. document.chmod.t_group.value=""
  87. }else {
  88. var a=(document.chmod.h_group.value);
  89. b=a-(number);
  90. c=eval(b);
  91. document.chmod.h_group.value=c
  92. document.chmod.t_group.value=c
  93. }}if (user == "other"){
  94. if (document.chmod.h_other.value == ""){
  95. document.chmod.t_other.value=""
  96. }else {
  97. var a=(document.chmod.h_other.value);
  98. b=a-(number);
  99. c=eval(b);
  100. document.chmod.h_other.value=c
  101. document.chmod.t_other.value=c
  102. }}
  103. }}
  104. // -->
  105. </script>
  106. <form name="chmod">
  107. <input name="h_superuser" type="hidden"><input name="h_owner" type="hidden"><input name="h_group" type="hidden"><input name="h_other" type="hidden">
  108. <table bgcolor="black" cellpadding="5" cellspacing="1">
  109. <tr bgcolor="white">
  110. <td colspan="6">
  111. <center>
  112. <font face="Verdana" size="3"><b>4-digit Chmod</b></font></center>
  113. </td>
  114. </tr>
  115. <tr bgcolor="white" align="center">
  116. <td colspan="2"><font face="Verdana" size="2"><b>Superuser</b></font></td>
  117. <td><font face="Verdana" size="2"><b>Permission</b></font></td>
  118. <td><font face="Verdana" size="2"><b>Owner</b></font></td>
  119. <td><font face="Verdana" size="2"><b>Group</b></font></td>
  120. <td><font face="Verdana" size="2"><b>Other</b></font></td>
  121. </tr>
  122. <tr bgcolor="white" align="center">
  123. <td><font face="Verdana" size="2"><b>setuid</b></font></td>
  124. <td><input type="checkbox" name="superuser4" value="4" onclick="calculator('superuser', 4)"></td>
  125. <td><font face="Verdana" size="2"><b>Read</b></font></td>
  126. <td><input type="checkbox" name="owner4" value="4" onclick="calculator('owner', 4)"></td>
  127. <td><input type="checkbox" name="group4" value="4" onclick="calculator('group', 4)"></td>
  128. <td><input type="checkbox" name="other4" value="4" onclick="calculator('other', 4)"></td>
  129. </tr>
  130. <tr bgcolor="white" align="center">
  131. <td><font face="Verdana" size="2"><b>setgid</b></font></td>
  132. <td><input type="checkbox" name="superuser2" value="2" onclick="calculator('superuser', 2)"></td>
  133. <td><font face="Verdana" size="2"><b>Write</b></font></td>
  134. <td><input type="checkbox" name="owner2" value="2" onclick="calculator('owner', 2)"></td>
  135. <td><input type="checkbox" name="group2" value="2" onclick="calculator('group', 2)"></td>
  136. <td><input type="checkbox" name="other2" value="2" onclick="calculator('other', 2)"></td>
  137. </tr>
  138. <tr bgcolor="white" align="center">
  139. <td><font face="Verdana" size="2"><b>stickybit</b></font></td>
  140. <td><input type="checkbox" name="superuser1" value="1" onclick="calculator('superuser', 1)"></td>
  141. <td><font face="Verdana" size="2"><b>Execute</b></font></td>
  142. <td><input type="checkbox" name="owner1" value="1" onclick="calculator('owner', 1)"></td>
  143. <td><input type="checkbox" name="group1" value="1" onclick="calculator('group', 1)"></td>
  144. <td><input type="checkbox" name="other1" value="1" onclick="calculator('other', 1)"></td>
  145. </tr>
  146. <tr bgcolor="white" align="center">
  147. <td><font face="Verdana" size="2"><b>Value</b></font></td>
  148. <td><input type="text" name="t_superuser" size="1"></td>
  149. <td><b>+</b></td>
  150. <td><input type="text" name="t_owner" size="1"></td>
  151. <td><input type="text" name="t_group" size="1"></td>
  152. <td><input type="text" name="t_other" size="1"></td>
  153. </tr>
  154. </table>
  155. </form>
  156.  
  157.  
  158.  
  159. <!-- END OF SCRIPT -->
  160. <!/SCRIPT>
  161.  
  162. <!PREVIEW>
  163. <!-- START OF SCRIPT -->
  164. <script language="JavaScript">
  165. <!--
  166. // 4-digit Chmod calculator
  167. // Based on code by Peter Crouch 2000. All rights reserved.
  168. // Modified 2001 to 4-digit by William E. Landfair-Owens
  169. // http://welo.ikemail.com
  170.  
  171. function calculator(user, number){
  172. // Superuser
  173. if (user == "superuser" && number == "4"){var box = eval("document.chmod.superuser4")}
  174. if (user == "superuser" && number == "2"){var box = eval("document.chmod.superuser2")}
  175. if (user == "superuser" && number == "1"){var box = eval("document.chmod.superuser1")}
  176. // Owner
  177. if (user == "owner" && number == "4"){var box = eval("document.chmod.owner4")}
  178. if (user == "owner" && number == "2"){var box = eval("document.chmod.owner2")}
  179. if (user == "owner" && number == "1"){var box = eval("document.chmod.owner1")}
  180. // Group
  181. if (user == "group" && number == "4"){var box = eval("document.chmod.group4")}
  182. if (user == "group" && number == "2"){var box = eval("document.chmod.group2")}
  183. if (user == "group" && number == "1"){var box = eval("document.chmod.group1")}
  184. // Other
  185. if (user == "other" && number == "4"){var box = eval("document.chmod.other4")}
  186. if (user == "other" && number == "2"){var box = eval("document.chmod.other2")}
  187. if (user == "other" && number == "1"){var box = eval("document.chmod.other1")}
  188. if (box.checked == true){
  189. if (user == "superuser"){
  190. document.chmod.h_superuser.value += ("+number")
  191. var a= (document.chmod.h_superuser.value)
  192. var b= eval(a)
  193. document.chmod.h_superuser.value=b
  194. document.chmod.t_superuser.value=b
  195. }if (user == "owner"){
  196. document.chmod.h_owner.value += ("+number")
  197. var a= (document.chmod.h_owner.value)
  198. var b= eval(a)
  199. document.chmod.h_owner.value=b
  200. document.chmod.t_owner.value=b
  201. }if (user == "group"){
  202. document.chmod.h_group.value += ("+number")
  203. var a= (document.chmod.h_group.value)
  204. var b= eval(a)
  205. document.chmod.h_group.value=b
  206. document.chmod.t_group.value=b
  207. }if (user == "other"){
  208. document.chmod.h_other.value += ("+number")
  209. var a= (document.chmod.h_other.value)
  210. var b= eval(a)
  211. document.chmod.h_other.value=b
  212. document.chmod.t_other.value=b
  213. }
  214. }
  215. if (box.checked == false){
  216. if (user == "superuser"){
  217. if (document.chmod.h_superuser.value == ""){
  218. document.chmod.t_superuser.value=""
  219. }else {
  220. var a=(document.chmod.h_superuser.value);
  221. b=a-(number);
  222. c=eval(b);
  223. document.chmod.h_superuser.value=c
  224. document.chmod.t_superuser.value=c
  225. }}if (user == "owner"){
  226. if (document.chmod.h_owner.value == ""){
  227. document.chmod.t_owner.value=""
  228. }else {
  229. var a=(document.chmod.h_owner.value);
  230. b=a-(number);
  231. c=eval(b);
  232. document.chmod.h_owner.value=c
  233. document.chmod.t_owner.value=c
  234. }}if (user == "group"){
  235. if (document.chmod.h_group.value == ""){
  236. document.chmod.t_group.value=""
  237. }else {
  238. var a=(document.chmod.h_group.value);
  239. b=a-(number);
  240. c=eval(b);
  241. document.chmod.h_group.value=c
  242. document.chmod.t_group.value=c
  243. }}if (user == "other"){
  244. if (document.chmod.h_other.value == ""){
  245. document.chmod.t_other.value=""
  246. }else {
  247. var a=(document.chmod.h_other.value);
  248. b=a-(number);
  249. c=eval(b);
  250. document.chmod.h_other.value=c
  251. document.chmod.t_other.value=c
  252. }}
  253. }}
  254. // -->
  255. </script>
  256. <form name="chmod">
  257. <input name="h_superuser" type="hidden"><input name="h_owner" type="hidden"><input name="h_group" type="hidden"><input name="h_other" type="hidden">
  258. <table bgcolor="black" cellpadding="5" cellspacing="1">
  259. <tr bgcolor="white">
  260. <td colspan="6">
  261. <center>
  262. <font face="Verdana" size="3"><b>4-digit Chmod</b></font></center>
  263. </td>
  264. </tr>
  265. <tr bgcolor="white" align="center">
  266. <td colspan="2"><font face="Verdana" size="2"><b>Superuser</b></font></td>
  267. <td><font face="Verdana" size="2"><b>Permission</b></font></td>
  268. <td><font face="Verdana" size="2"><b>Owner</b></font></td>
  269. <td><font face="Verdana" size="2"><b>Group</b></font></td>
  270. <td><font face="Verdana" size="2"><b>Other</b></font></td>
  271. </tr>
  272. <tr bgcolor="white" align="center">
  273. <td><font face="Verdana" size="2"><b>setuid</b></font></td>
  274. <td><input type="checkbox" name="superuser4" value="4" onclick="calculator('superuser', 4)"></td>
  275. <td><font face="Verdana" size="2"><b>Read</b></font></td>
  276. <td><input type="checkbox" name="owner4" value="4" onclick="calculator('owner', 4)"></td>
  277. <td><input type="checkbox" name="group4" value="4" onclick="calculator('group', 4)"></td>
  278. <td><input type="checkbox" name="other4" value="4" onclick="calculator('other', 4)"></td>
  279. </tr>
  280. <tr bgcolor="white" align="center">
  281. <td><font face="Verdana" size="2"><b>setgid</b></font></td>
  282. <td><input type="checkbox" name="superuser2" value="2" onclick="calculator('superuser', 2)"></td>
  283. <td><font face="Verdana" size="2"><b>Write</b></font></td>
  284. <td><input type="checkbox" name="owner2" value="2" onclick="calculator('owner', 2)"></td>
  285. <td><input type="checkbox" name="group2" value="2" onclick="calculator('group', 2)"></td>
  286. <td><input type="checkbox" name="other2" value="2" onclick="calculator('other', 2)"></td>
  287. </tr>
  288. <tr bgcolor="white" align="center">
  289. <td><font face="Verdana" size="2"><b>stickybit</b></font></td>
  290. <td><input type="checkbox" name="superuser1" value="1" onclick="calculator('superuser', 1)"></td>
  291. <td><font face="Verdana" size="2"><b>Execute</b></font></td>
  292. <td><input type="checkbox" name="owner1" value="1" onclick="calculator('owner', 1)"></td>
  293. <td><input type="checkbox" name="group1" value="1" onclick="calculator('group', 1)"></td>
  294. <td><input type="checkbox" name="other1" value="1" onclick="calculator('other', 1)"></td>
  295. </tr>
  296. <tr bgcolor="white" align="center">
  297. <td><font face="Verdana" size="2"><b>Value</b></font></td>
  298. <td><input type="text" name="t_superuser" size="1"></td>
  299. <td><b>+</b></td>
  300. <td><input type="text" name="t_owner" size="1"></td>
  301. <td><input type="text" name="t_group" size="1"></td>
  302. <td><input type="text" name="t_other" size="1"></td>
  303. </tr>
  304. </table>
  305. </form>
  306.  
  307.  
  308.  
  309.  
  310.  
  311. <!-- END OF SCRIPT -->
  312. <!/PREVIEW>
  313.  
  314. <!RELATED>NONE<!/RELATED>